package demo1;

import java.util.LinkedList;
import java.util.List;
import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        test1();
        System.out.println("---------------");
        test2();
    }

    /**
     * 官方Stack类的测试
     */
    public static void test1() {
        Stack<Integer> stack = new Stack<>();
        stack.push(10);
        stack.push(20);
        stack.push(30);
        stack.push(40);
        stack.pop();
        System.out.println(stack);
        System.out.println(stack.size());
        System.out.println(stack.peek());
        System.out.println(stack.empty());
        System.out.println(stack.search(10));
    }
    /**
     * 自己实现的Stack类的测试
     */
    public static void test2() {
        MyStack<Integer> myStack = new MyStack<>();
        myStack.push(10);
        myStack.push(20);
        myStack.push(30);
        myStack.push(40);
        myStack.pop();
        myStack.display();
        System.out.println(myStack.size());
        System.out.println(myStack.peek());
    }
}
